//
//  DDChatHeaderReusableView.m
//  DingDongZP
//
//  Created by 王威 on 16/3/20.
//  Copyright © 2016年 iyhjiang.com. All rights reserved.
//

#import "DDChatHeaderReusableView.h"
#import "DDChatJobCell.h"

@interface DDChatHeaderReusableView ()

@property (strong, nonatomic) UILabel *tipsContentLabel;

@property (nonatomic, strong) DDChatJobCell *jobView;

@end

@implementation DDChatHeaderReusableView

//  设置 工作卡片
- (void)setJobsDetail:(DDJobsDetail *)jobsDetail
{
    _jobsDetail = jobsDetail;
    
    self.jobView = [[[NSBundle mainBundle] loadNibNamed:@"DDChatJobCell" owner:self options:nil] lastObject];
    
    [self addSubview:_jobView];
    [_jobView updateJobDetailCellWithInfo:jobsDetail];
    
    [_jobView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self);
        make.top.equalTo(self).and.offset(10+44);
        make.right.equalTo(self);
        make.height.mas_equalTo(@160);
    }];
}

- (void)setShowTips:(BOOL)showTips
{

    if (self.tipsContentLabel) {
        
        [self.tipsContentLabel removeFromSuperview];
    }
    
    _showTips = showTips;
    if (_showTips) {
        
        self.tipsContentLabel = [[UILabel alloc] init];
        self.tipsContentLabel.font = [UIFont systemFontOfSize:12];
        self.tipsContentLabel.textAlignment = 1;
        [self addSubview:_tipsContentLabel];
        
        [self setData];
        
        [self.tipsContentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(@(40+10+160+30));
            make.left.equalTo(self).offset(20);
            make.right.equalTo(self).offset(-20);
        }];
    }
}

- (void)setData
{
    
    // YES  表示跟Boss聊天   显示牛人的直聘技巧，相反显示boss的直聘技巧
    if (self.isBoss == YES) {

        self.tipsContentLabel.attributedText = [DDUtils image:@"多边形1" ContentText:@"打个招呼，介绍下自己，聊聊自己的优势吧！"];
        self.tipsContentLabel.textColor = COLOR_FONT_ALERTGREEN;

    }else{

        self.tipsContentLabel.attributedText = [DDUtils image:@"多边形1" ContentText:@"打个招呼，介绍下自己，聊聊您对此职位的期待吧！"];
        self.tipsContentLabel.textColor = COLOR_FONT_ALERTGREEN;
    }
}


- (void)setResumeInfoLabelWithBossName:(NSString *)bossName
{
    // 通过判断是跟boss聊天还是跟牛人聊天，来显示不同的直聘技巧    跟牛人聊天显示，显示boss的直聘技巧；跟boss聊天，显示牛人的直聘技巧
    NSRange judgement = [bossName rangeOfString:@"Boss"];
    if (judgement.location != NSNotFound){
        self.isBoss = YES;    //  跟boss聊天
    }else{
        self.isBoss = NO;    //  跟牛人聊天
    }
}

@end
